<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">

    <ui:define name="body">

        <h:messages globalOnly="true" styleClass="message"/>

        <h:form id="studentLearningOutcomeForm">

            <rich:panel>
                <f:facet name="header">#{messages['nav.studentlearningoutcome']}</f:facet>
                <rich:simpleTogglePanel label="#{studentLearningOutcomeHome.instance.student != null ? studentLearningOutcomeHome.instance.student.name : messages['slo.details']}"
                                        switchType="ajax"
                                        opened="true">
                    <h:outputText value="#{messages['slo.nostudent']}" id="noStudent" rendered="#{!studentLearningOutcomeHome.wired}"/>
                    <s:decorate id="studentNumberDecoration" template="layout/display.xhtml">
                        <ui:define name="label">#{messages['student.number']}</ui:define>
                        #{studentLearningOutcomeHome.instance.student.studentNumber}
                    </s:decorate>
                    <s:decorate id="fnameDecoration" template="layout/display.xhtml">
                        <ui:define name="label">#{messages['student.firstname']}</ui:define>
                        #{studentLearningOutcomeHome.instance.student.firstName}
                    </s:decorate>
                    <s:decorate id="lnameDecoration" template="layout/display.xhtml">
                        <ui:define name="label">#{messages['student.lastname']}</ui:define>
                        #{studentLearningOutcomeHome.instance.student.lastName}
                    </s:decorate>
                    <s:decorate id="posDecoration" template="layout/display.xhtml">
                        <ui:define name="label">#{messages['student.pos']}</ui:define>
                        #{studentLearningOutcomeHome.instance.student.programOfStudy.programCode} - #{studentLearningOutcomeHome.instance.student.programOfStudy.name}
                    </s:decorate>

                    <div style="clear:both"/>
                </rich:simpleTogglePanel>

                <p></p>
                <s:decorate id="dateDecoration" template="layout/display.xhtml">
                    <ui:define name="label">#{messages['date']}</ui:define>
                    <h:outputText id="date" value="#{studentLearningOutcomeHome.instance.date}">
                        <s:convertDateTime type="date" />
                    </h:outputText>
                </s:decorate>
                <s:decorate id="inCooperationDecoration" template="layout/display.xhtml">
                    <ui:define name="label">#{messages['slo.company']}</ui:define>
                    <h:selectBooleanCheckbox id="inCooperationWithCompany" disabled="true"
                                             value="#{studentLearningOutcomeHome.instance.inCooperationWithCompany}" />
                </s:decorate>

                <div style="clear:both"/>
                <p></p>
                <rich:simpleTogglePanel label="#{messages['trait.label']}" switchType="ajax">
                    <h:outputText value="#{messages['trait.notraits']}" id="noTraits" rendered="#{empty studentLearningOutcomeHome.positions}"/>
                    <rich:dataTable value="#{studentLearningOutcomeHome.positions}" var="_position" rendered="#{not empty studentLearningOutcomeHome.positions}">
                        <rich:column>
                            <f:facet name="header">#{messages['trait.number']}</f:facet>
                            #{_position.trait.number}
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">#{messages['trait.label']}</f:facet>
                            #{_position.trait.name}
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">#{messages['trait.failsexpectations']}</f:facet>
                            #{_position.trait.failsExpectations}
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">#{messages['trait.meetsexpectations']}</f:facet>
                            #{_position.trait.meetsExpectations}
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">#{messages['trait.exceedsexpectations']}</f:facet>
                            #{_position.trait.exceedsExpectations}
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">#{messages['result.label']}</f:facet>
                            #{_position.result.description}
                        </rich:column>
                    </rich:dataTable>
                    <s:button id="selectLearningOutcome"
                              value="#{messages['slo.selectslo']}"
                              view="/learningOutcomeList.xhtml"
                              rendered="#{empty studentLearningOutcomeHome.positions}"
                              propagation="none">
                        <f:param name="studentLearningOutcomeId" value="#{studentLearningOutcomeHome.instance.id}" />
                        <f:param name="loListFrom" value="studentLearningOutcomeEdit" />
                    </s:button>
                    <div style="clear:both"/>
                </rich:simpleTogglePanel>
                <p></p>
                <rich:simpleTogglePanel label="#{messages['slo.comment']}" switchType="ajax" opened="true">
                    <s:decorate id="commentDecoration" template="layout/display.xhtml">
                        <ui:define name="label">#{messages['slo.comment']}</ui:define>
                        <h:inputTextarea id="comment" required="false" disabled="true"
                                         value="#{studentLearningOutcomeHome.instance.comment}"
                                         rows="10" cols="50"/>
                    </s:decorate>
                    <div style="clear:both"/>
                </rich:simpleTogglePanel>
                <div style="clear:both"/>
            </rich:panel>
            <div class="actionButtons">
                <s:button view="/studentLearningOutcomeEdit.xhtml"
                          id="edit"
                          value="#{messages['button.edit']}">
                    <f:param name="sloEditFrom" value="studentLearningOutcome"/>
                </s:button>
                <s:button propagation="none"
                          view="/#{empty studentLearningOutcomeFrom ? 'studentLearningOutcomeList' : studentLearningOutcomeFrom}.xhtml"
                          id="done"
                          value="#{messages['button.done']}"/>
            </div>
        </h:form>
    </ui:define>
</ui:composition>